
/**
 * @file        usbd_composite.h
 * @author      Weyne
 * @version     V01
 * @date        2016.10.28
 * @brief       MSC + CDC 复合设备
 * @note
 * @attention   COYPRIGHT WEYNE
 */

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __USBD_COMPOSITE_H
#define __USBD_COMPOSITE_H

#ifdef __cplusplus
 extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
#include  "usbd_customhid.h"
#include  "usbd_cdc.h"
#include "usbd_custom_hid_if.h"
#include "usbd_cdc_if.h"
#include "usbd_storage_if.h"

#define WBVAL(x) (x & 0xFF),((x >> 8) & 0xFF)
#define DBVAL(x) (x & 0xFF),((x >> 8) & 0xFF),((x >> 16) & 0xFF),((x >> 24) & 0xFF)

#define USBD_IAD_DESC_SIZE           0x08
#define USBD_IAD_DESCRIPTOR_TYPE     0x0B



#define USBD_CDC_FIRST_INTERFACE     0          /* CDC FirstInterface */
#define USBD_CDC_INTERFACE_NUM       2          /* CDC Interface NUM */

#define USBD_CDC_CMD_INTERFACE       0
#define USBD_CDC_DATA_INTERFACE      1

#define USBD_HID_FIRST_INTERFACE     2          /* HID FirstInterface */
#define USBD_HID_INTERFACE_NUM       1          /* HID Interface NUM */

#define USBD_HID_INTERFACE           2
#define USBD_MSC_INTERFACE           3

#define HID_INDATA_NUM              (CUSTOM_HID_EPIN_ADDR & 0x0F)
#define HID_OUTDATA_NUM             (CUSTOM_HID_EPOUT_ADDR & 0x0F)

#define CDC_INDATA_NUM              (CDC_IN_EP & 0x0F)
#define CDC_OUTDATA_NUM             (CDC_OUT_EP & 0x0F)
#define CDC_OUTCMD_NUM              (CDC_CMD_EP & 0x0F)

#define MSC_INDATA_NUM              (MSC_EPIN_ADDR & 0x0F)
#define MSC_OUTDATA_NUM             (MSC_EPOUT_ADDR & 0x0F)
#define USBD_COMPOSITE_DESC_SIZE    130


typedef enum 
{ //这个位顺序与hid描述符顺序一致
  eUSBHID_REPORT_PP = 0x00, //Play/Pause
  eUSBHID_REPORT_Next, //下一曲
  eUSBHID_REPORT_Pre, //上一曲
  eUSBHID_REPORT_VolUp, //音量+
  eUSBHID_REPORT_VolDown, //音量-
  eUSBHID_REPORT_Mute, //静音和解除静音
} eUSBHID_REPORT;


extern USBD_ClassTypeDef    USBD_COMPOSITE;
// int8_t USBD_CUSTOM_HID_SendReport_FS(uint8_t *report, uint16_t len);
int USBD_CUSTOM_HID_CtrlMusicPress(eUSBHID_REPORT type);
int USBD_CUSTOM_HID_CtrlMusicRelease(void);

/**
  * @}
  */

/**
  * @}
  */

#ifdef __cplusplus
}
#endif

#endif  /* __USBD_MSC_H */
/**
  * @}
  */

/************************ (C) COPYRIGHT WEYNE *****END OF FILE****/

